<!--站点列表页-->
<template>
    <div style="height: 100%;">

        <m-page-list
                :option="option"
                :page="page"
                :total="total"
                :table-data="tableData"
                :table-loading="tableLoading"
                v-model:value="query"
                @h-btn-click="hBtnClick"
                @col-btn-click="colBtnClick"
                @search-data="searchData"
        />
        <m-dialog-form ref="dialogRef" :data="dialogData" v-model:show="dialogShow" :option="dialogOption" @confirm="dialogConfirm" ></m-dialog-form>
    </div>

</template>

<script setup>

  import {ref,reactive,onMounted,nextTick} from 'vue'
  //组件
  import MPageList from '@/components/PageList'
  import MDialogForm from '@/components/DialogForm/DialogForm'

  //请求
  import {getAfterPaymentSchool,addAfterPaymentSchool,editAfterPaymentSchool,delAfterPaymentSchool} from '@/request/api/basicData'

  import {usePageList} from "../../composables/pageList";

  import {refOpt} from "../const";

  let opts = {
    auth_id: 'school',
    getApi: getAfterPaymentSchool,addApi:addAfterPaymentSchool,editApi:editAfterPaymentSchool,delApi:delAfterPaymentSchool,
    idKey: 'school_id',
    dialogDefVal: {
      "set_null_fields": ["pay_time_end"]
    }
  };

  let {option,page,total,tableLoading,tableData,query,dialogRef,dialogShow,dialogData,dialogOption,
    hBtnClick,colBtnClick,searchData,getDataList,dialogConfirm} = usePageList(opts);

  option.conditions = [
    {...refOpt.school_name,rewriteInput: true,col: 24},
  ];
  option.cols = [
    {prop: 'school_id', label: '站点编号',},
    {prop: 'school_name', label: '站点名称',},
    {prop: 'is_used',label: '使用标识',type: 'bool' },
    {prop: 'pay_agreement_name',label: '缴费说明协议名称' },
    {prop: 'is_need_sign',label: '需要签协议',type: 'bool' },
    {prop: 'sign_agreement_name',label: '签名协议名称' },
    {prop: 'pay_time_end',label: '截止支付时间' },
    {prop: 'is_feedback',label: '启用意见反馈',type: 'bool' },
    {prop: 'input_id',label: '录入员号' },
    {prop: 'input_name',label: '录入员名' },
    {prop: 'input_time',label: '录入时间' },
    {prop: 'modify_id',label: '修改员号' },
    {prop: 'modify_name',label: '修改员名' },
    {prop: 'modify_time',label: '修改时间' },
  ];
  dialogOption.fieldList = [
    {...refOpt.school_id,col:3,required: true,},
    {...refOpt.school_name,col:3,required: true,},
    {...refOpt.agreement_id,col:3,label: '缴费说明协议编号',required: false,field_id: 'pay_agreement_id',},
    {...refOpt.agreement_name,col:3,label: '缴费说明协议名称',required: false,field_id: 'pay_agreement_name', valueKey: [{'pay_agreement_id': 'agreement_id'},{'pay_agreement_name': 'agreement_name'}] ,},
    {field_id: 'is_need_sign',label: '需要签协议',type: 'bool',col: 3 },
    {...refOpt.agreement_id,col:3,label: '签名协议编号',required: false,field_id: 'sign_agreement_id',},
    {...refOpt.agreement_name,col:3,label: '签名协议名称',required: false,field_id: 'sign_agreement_name', valueKey: [{'sign_agreement_id': 'agreement_id'},{'sign_agreement_name': 'agreement_name'}] ,},
    {field_id: 'is_used',label: '使用标识',type: 'bool',col: 3 },
    {field_id: 'pay_time_end',label: '截止支付时间',type: 'datetime',col: 3 },
    {field_id: 'is_feedback',label: '启用意见反馈',type: 'bool',col: 3 },
  ];
</script>

<style scoped lang="less">

</style>
